package main

import (
	"net"
	"net/rpc"
	"net/rpc/jsonrpc"
)

type ClickService struct {
}

func (s *ClickService) Click(request string, replay *string) error {
	*replay = "click " + request
	return nil
}
func main() {
	listen, _ := net.Listen("tcp", ":8888")
	_ = rpc.RegisterName("ClickService", &ClickService{})
	for {
		conn, _ := listen.Accept()
		//go rpc.ServeConn(conn)
		go rpc.ServeCodec(jsonrpc.NewServerCodec(conn))
	}
}
